<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/WEB-INF/templates/BasicTemplate.xhtml">

	<ui:define name="content">
		<f:event type="preRenderView"
			listener="#{interviewController.beforeEdit}" />
		<div class="title ui-widget-header ui-corner-all">
			<h:panelGrid style="margin:auto;">
		EDITAR ENTREVISTA
		</h:panelGrid>

		</div>
		<h:form id="formEdit">
			<h:panelGrid style="margin:auto;">

				<h:panelGrid style="margin:auto;text-align:center;">
					<p:messages id="messages"></p:messages>

				</h:panelGrid>



				<h:panelGrid columns="4">

					<p:outputLabel value="Postulante: "></p:outputLabel>
					<p:outputLabel
						value="#{interviewController.interviewSelected.candidate.firstname} #{interviewController.interviewSelected.candidate.lastname}"
						id="name"></p:outputLabel>

					<p:outputLabel value="DNI: "></p:outputLabel>
					<p:outputLabel
						value="#{interviewController.interviewSelected.candidate.documentNumber}"
						id="document_number"></p:outputLabel>


					<p:outputLabel value="Estado"></p:outputLabel>

					<p:selectOneMenu value="#{interviewController.stateSelected}" disabled="#{!interviewController.isPending}"
						required="true" requiredMessage="Debe seleccionar Estado">
						<f:selectItems value="#{interviewController.states}"></f:selectItems>
						<p:ajax listener="#{interviewController.onChangeState}"
							update=":formEdit:calendarLabel :formEdit:calendarValue
							:formEdit:messages"></p:ajax>
					</p:selectOneMenu>
					
					<h:panelGroup id="calendarLabel">
						<p:outputLabel value="Fecha de capacitacion"
							rendered="#{interviewController.isGoal}"></p:outputLabel>
						<p:outputLabel value=""
							rendered="#{!interviewController.isGoal}"></p:outputLabel>	
					</h:panelGroup>
					
					<h:panelGroup id="calendarValue">
						<p:calendar rendered="#{interviewController.isGoal}"
							value="#{interviewController.trainingAt}" 
							disabled="#{!interviewController.fromOnChange}"
							pattern="dd-MM-yyyy hh:mm:ss a" required="true" stepMinute="10"
							requiredMessage="Debe seleccionar fecha de capacitacion">
						</p:calendar>
						<p:outputLabel value=""
							rendered="#{!interviewController.isGoal}"></p:outputLabel>
					</h:panelGroup>
					

					<p:outputLabel value="Fecha de Entrevista"></p:outputLabel>
					<p:calendar disabled="#{!interviewController.isPending}"
						value="#{interviewController.interviewSelected.interviewedAt}"
						pattern="dd-MM-yyyy hh:mm:ss a" required="true" stepMinute="10"
						requiredMessage="Debe seleccionar fecha de entrevista">
					</p:calendar>

					<p:outputLabel value="Reclutador"></p:outputLabel>
					<p:selectOneMenu id="recruitments" required="true"
						disabled="#{!interviewController.isPending}"
						requiredMessage="Debe seleccionar reclutador."
						value="#{interviewController.recruiterSelected}">
						<f:selectItems value="#{interviewController.recruiters}"></f:selectItems>
					</p:selectOneMenu>
					<p:outputLabel value="Comentarios:"></p:outputLabel>
					<p:inputTextarea
						value="#{interviewController.interviewSelected.comment}" rows="4"
						cols="30"></p:inputTextarea>

				</h:panelGrid>



				<h:panelGrid style="margin:auto;text-align:center;">
					<p:commandButton action="#{interviewController.edit}"
						value="Editar" ajax="false">
					</p:commandButton>
				</h:panelGrid>
			</h:panelGrid>
		</h:form>
	</ui:define>

</ui:composition>
</html>
